package example.simple_mindmap.consistency.dataFunc;

import example.simple_mindmap.chache.MindMapCache;
import example.simple_mindmap.domain.po.MindMap;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @Program: 8.mindmap
 * @Author: 海里的鱼
 * @Create: 2024-08-29 09:55
 * @Name: TODO
 * @Desc: TODO
 */
@Component
@RequiredArgsConstructor
public class UpdateRedis implements DataFunc {

    private final MindMapCache mindMapCache;

    @Override
    public boolean crudData(Object data) throws Exception {
//        if(true){
//            return false;
////            throw new Exception();
//        }
        MindMap mindMap = (MindMap)data;
        return mindMapCache.addOrUpdateMindMap2(mindMap);
    }

}
